package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsGoodsSpecificationMapper;
import com.qf.pojo.DtsGoodsSpecification;
import com.qf.service.DtsGoodsSpecificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Zwnan
 */
@Service
public class DtsGoodsSpecificationServiceImpl implements DtsGoodsSpecificationService {
    @Autowired
    private DtsGoodsSpecificationMapper dtsGoodsSpecificationMapper;
    @Override
    public void insert(DtsGoodsSpecification[] specifications) {
        for (DtsGoodsSpecification specification : specifications) {
            dtsGoodsSpecificationMapper.insert(specification);

        }
    }

    @Override
    public List<DtsGoodsSpecification> findByGoodsId(Integer id) {
        QueryWrapper<DtsGoodsSpecification> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("goods_id", id);
        queryWrapper.eq("deleted", false);

        return dtsGoodsSpecificationMapper.selectList(queryWrapper);
    }


    @Override
    public void updateByGid(Integer gid) {
        dtsGoodsSpecificationMapper.updateByGid(gid);
    }

    @Override
    public void deleteByGid(Integer gid) {
        dtsGoodsSpecificationMapper.updateByGid(gid);
    }


}
